package controller;
import entidades.Inmueble;
import entidades.Picture;
import javax.servlet.http.HttpSession;
import persistence.AccesoBD;
import java.util.LinkedList;
import javax.servlet.http.HttpServletRequest;
/**
 *
 * @author EOcampo
 */
public class GenerarHTMLAdmin extends GenerarHTMLGeneral{
    private LinkedList<Inmueble> lisInm;
    
    public GenerarHTMLAdmin( ){
       
    }
    
    public String GenerarMainConten(){ 
        String html="";
        html+="<div id=\"main_content\">\n";
        html+=  "<div id=\"admin_header\">\n";
        html+=      "<div class=\"admin_index_title\">Control de propiedades</div>\n";
        html+=      "<div class=\"right_buttons\">\n";
        html+=          "<div class=\"right_button\" style=\"text-align: left\"><a href=\"NuevaProp.jsp\">Agregar Propiedad</a></div>\n";
        html+=          "<div class=\"right_button\" style=\"text-align: left\"><a href=\"#\">Elim. Selecci&oacute;n</a></div>\n";
        html+=          "<div class=\"right_button\" style=\"text-align: left\"><a href=\"Gestionar.jsp\">Admin. Alq./ Venta</a></div>\n";
        html+=      "</div>\n";
        html+=  "</div>\n";//endOfAdmin_header
     
        return html;
     }
    
    public String GenerarAdminHeaderBorder(HttpServletRequest request,AccesoBD abd){
        String nameClass="even";
        LinkedList<Picture> picc =new LinkedList();
        try{
            lisInm=abd.listar(new Inmueble() ,"");
            }catch(Exception e){
        }
        picc=abd.listar(new Picture(),"");
        String html="";
        html+="<div id=\"admin_header_border\"></div>\n";
        html+=  "<div id=\"admin_search_tab\">\n";
        html+=      "<label class=\"search\" style=\"padding-top:12px;\">Buscar por ID: </label>\n";
        html+=      "<label class=\"search\"><input type=\"text\" name=\"search\" class=\"search_input\" /> <a href=\"#\"><img src=\"images/adminicons/search.png\" border=\"0\" /></a></label>\n";
        html+=  "</div>\n";//endAdmin_Search_tab
        html+=  "<div class=\"table_grid\">\n";
        html+=      "<table cellspacing=\"0\" cellpadding=\"0\">\n";
        html+=          "<tr>\n";
        html+=              "<th style=\"width:10px;\">Selecci&oacute;n</th>\n";
	html+=              "<th style=\"width:20px;\">ID</th>\n";
	html+=              "<th style=\"width:50px;\">Imagen</th>\n";
	html+=              "<th style=\"width:auto;\">Operaci&oacute;n</th>\n";
	html+=              "<th style=\"width:auto;\">Descripci&oacute;n</th>\n";
	html+=              "<th style=\"width:100px;\">Precio</th>\n";
	html+=              "<th style=\"width:50px;\">Editar</th>\n";
	html+=              "<th style=\"width:50px;\">Eliminar</th>\n";
        html+=          "</tr>\n";
        for (int i=0;i<=lisInm.size()-1;i++){
           // String condicion="inm.id=="+lisInm.get(i).getId()+" && tipo=='portadaAd'";
            //picc=abd.listar(new Picture(),condicion);
            html+=          "<tr class= "+nameClass+">\n";
            html+=              "<td><input type=\"checkbox\" name=\"checkbox\" /></td>\n";
            html+=              "<td>12</td>\n";
            html+=              "<td><img src=\"images/smallpic.gif\" width=\"53\" height=\"39\" border=\"0\" /></td>\n";
           // html+=              "<td><img src="+picc.getFirst().getPath()+" width=\"53\" height=\"39\" border=\"0\" /></td>\n";
            html+=              "<td>Lorem ipsum dolor sit amet</td>\n";
            html+=              "<td>Lorem ipsum dolor sit ametLorem ipsum dolor sit ametLorem ipsum dolor sit amet</td>\n";
            html+=              "<td><strong>60 000 &euro;</strong></td>\n";
            html+=              "<td><a href=\"Editor.jsp\"><img src=\"images/adminicons/edit.png\" width=\"22\" height=\"22\" border=\"0\" /></a></td>\n";
            html+=              "<td><a href=\"#\"><img src=\"images/adminicons/delete.png\" width=\"24\" height=\"24\" border=\"0\" /></a></td>\n";
            html+=          "</tr>\n";
            if((nameClass).compareTo("even")==0){
                nameClass="odd";
            }else if((nameClass).compareTo("odd")==0){
                nameClass="even";
            }
        }//endFor
        html+=      "</table>\n";//line49
        html+=  "</div>\n";//endTable_grid
        
       
       return html;
       }                                    
}
